﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;

namespace _0712502_0712504_DesignPatternGame
{
    public class MyImageManager
    {
        ContentManager content;
       
        public Texture2D[] MainMenuItemImages;


        // Anh backgorund cho main menu
        public Texture2D ImageForMainMenu;

        // Anh background cho option menu
        public Texture2D ImageForOptionsMenu;


        // Anh cho selector

        public Texture2D SelectorImage;
        public Texture2D rect;
        public Texture2D rect54;

        //Anh cho player tank
        public Texture2D PlayerTankbodyImage;


        public Texture2D[] PlayerTankBody;
        public Texture2D[] PlayerTankTurret;

        public Texture2D[] ComTankBody;
        public Texture2D[] ComTankTurret;

        public Texture2D[] BulletImgs;
        public Texture2D enemyTankIcon;
        
        public Texture2D playerTankIcon;
        public Texture2D tankHealthIcon;

        public Texture2D enemyHealthyBar;
        public Texture2D[] tankBulletIcons;

        public Texture2D PlayerTankTurretImage;


        //Anh cho dan
        Texture2D _danImage;

        public Texture2D DanImage
        {
            get { return _danImage; }
            set { _danImage = value; }
        }

        Texture2D[] _chosePlayerItems;

        public Texture2D[] ChosePlayerItems;


        public Texture2D ChosePlayerBackground;

        //Texture di.a hinh cho map
        public Texture2D[] GrassImgs;
        public Texture2D[] SnowImgs;
        public Texture2D[] RockImgs;
        public Texture2D[] WaterImgs;
        public Texture2D[] BrickImgs;
        public Texture2D[] BackGroundImgs;
        // Computer tank
        public Texture2D ComTank1, ComTank2;
        // Vat lieu cho map khung canh va background
        public Texture2D[] mapLandScapeMaterials;
        public Texture2D[] mapBackgroundMaterials;
        public Texture2D[] mapRightTopBorderMaterials;

        // Image cho dan
        public Texture2D[] DanImages;

        // Image cho các Item
        public Texture2D[] starItemImages;
        public Texture2D[] heathlyBoxImages;
        public Texture2D[] lifeItemImages;
        public Texture2D[] nuclearBombImages;

        public MyImageManager(ContentManager content)
        {
            this.content = content;
            LoadContent();
        }

        public Texture2D[] playerTankBody;
        public void LoadContent()
        {
            // Load meterials cho Terrain
            GrassImgs = LoadImages("concrete", 4);
            RockImgs = LoadImages("forest", 1);
            //  SnowImgs = LoadImages("Snow", 1);
            // WaterImgs = LoadImages("Water", 1);
            BrickImgs = LoadImages("brick", 4);


            playerTankBody = LoadImages("body", 1);
            ComTankTurret = LoadImages("comTankTurret", 4);
            ComTankBody = LoadImages("comTankBody", 4);

            PlayerTankTurret = LoadImages("playerTankTurret", 3);
            PlayerTankBody = LoadImages("playerTankBody", 3);
            BulletImgs = LoadImages("bullet", 3);

            BackGroundImgs = LoadImages("background", 13);
            mapRightTopBorderMaterials = LoadImages("righttopborder", 1);
            mapLandScapeMaterials = LoadImages("landscape", 5);

            tankBulletIcons = LoadImages("bulletIcon", 1);
            enemyTankIcon = LoadImage("enemyTankIcon");
            playerTankIcon = LoadImage("playerTankIcon");
            tankHealthIcon = LoadImage("tankHealthIcon");

            enemyHealthyBar = LoadImage("enemyHealthyBar");
            rect = LoadImage("rect");
            rect54 = LoadImage("rect54");

            // Item product
            starItemImages = LoadImages("starItem", 1);
            heathlyBoxImages = LoadImages("healthyBox", 1);
            nuclearBombImages = LoadImages("nuclearBomb", 1);
            lifeItemImages = LoadImages("tankLife", 1);

        }

        public Texture2D[] LoadImages(String strResource, int nImg)
        {
            Texture2D[] textures = new Texture2D[nImg];
            for (int i = 0; i < nImg; i++)
            {
                textures[i] = content.Load<Texture2D>(@"Images/" + strResource + i.ToString("00"));
            }

            return textures;
        }

        public Texture2D LoadImage(String strResource)
        {
            return content.Load<Texture2D>(@"Images/" + strResource);
        }


    }
}
